import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  // {
  //   path: "/home",
  //   name: "Home",
  //   component: Home,
  // },
  // {
  //   path: "/list",
  //   name: "list",
  //   component: () => import("../views/list.vue"),
  // },
  {
    path: "/index",
    name: "index",
    component: () => import("../views/Index.vue"),
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("../views/Home.vue"),
      },
      {
        path: "/list",
        name: "list",
        component: () => import("../views/List.vue"),
      },
    ],
    //规定谁在index的坑里加载
  },
  {
    path: "/shopcar",
    name: "shopcar",
    component: () => import("../views/Shopcar.vue"),
  },
  {
    path: "/my",
    name: "my",
    component: () => import("../views/My.vue"),
  },
  {
    path: "/show",
    name: "show",
    component: () => import("../views/Show.vue"),
    children: [
      {
        path: "/showhome",
        name: "showhome",
        component: () => import("../views/show/Home.vue"),
      },
      {
        path: "/showorder",
        name: "showorder",
        component: () => import("../views/show/Order.vue"),
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
